<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>班级管理</title>
    <link rel="stylesheet" th:href="@{/plugins/layui/css/layui.css}">
</head>
<body>
<div th:object="${class}" class="layui-form">
    <input type="hidden" id="classId" th:field="*{classId}">

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">所属年级</label>
            <div class="layui-input-block">
                <select id="gradeId" name="gradeId" lay-verify="required" th:with="grades=${@gradeService.list()}">
                    <option value="">请选择</option>
                    <option th:each="grade : ${grades}" th:text="${grade.gradeName}" th:value="${grade.gradeId}"
                            th:selected="${class != null and class.gradeId != null and grade.gradeId == class.gradeId}"></option>
                </select>
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">班级名称</label>
            <div class="layui-input-block">
                <input type="text" id="className" name="className" th:field="*{className}" required
                       lay-verify="required"
                       autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
</div>

<script th:src="@{/js/jquery.min.js}"></script>
<script th:src="@{/plugins/layui/layui.js}"></script>
</body>
</html>